package com.dmzc.stage2.chapter14;

/***
 * Holder方式,借助静态内部类的方式，静态类加载的static会被收集到<cinit>,能够保证
 * 线程安全
 */
public class Singleton5 {
    private byte[] data=new byte[1024];
    private Singleton5(){}
    private static class Holder{
        private static Singleton5 instance=new Singleton5();
    }
    public static Singleton5 getInstance(){
        return Holder.instance;
    }
}
